package org.dnd.rcp.editor.actions;

import org.dnd.rcp.editor.text.IActionsID;
import org.dnd.rcp.editor.text.TextSource;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IEditorPart;

/**
 * Paste Action
 * 
 * @author dendy
 * 
 */
public class PasteTextAction extends Action {

	private TextSource textSource;

	public PasteTextAction() {
		setId(IActionsID.PASTE_ID);
	}

	public void setEditor(IEditorPart newEditor) {
		if (newEditor instanceof TextSource)
			textSource = (TextSource) newEditor;
		else
			textSource = null;
	}

	public void run() {
		textSource.getText().paste();
	}

}
